#include "boss_bullet.h"
#include "config.h"

Boss_Bullet::Boss_Bullet()
{

    //加载boss子弹资源
    m_boss_Bullet.load(BOSS_BULLET);


    //boss子弹坐标
    m_boss_X =(GAME_WIDTH-m_boss_Bullet.width())*0.5;
    m_boss_Y = m_boss_Bullet.height();


    //boss子弹状态
    m_boss_Free = true;

    //子弹速度
    m_boss_Speed = BULLET_SPEED;


    //boss子弹边框
    m_boss_Rect.setWidth(m_boss_Bullet.width());
    m_boss_Rect.setHeight(m_boss_Bullet.height());
    m_boss_Rect.moveTo(m_boss_X,m_boss_Y);
}



//更新boss子弹位置
void Boss_Bullet::update_boss_Position()
{
    //空闲状态下的子弹，不需要计算坐标
    if(m_boss_Free)
    {
        return;
    }

    //子弹向下移动
    m_boss_Y+=m_boss_Speed;
    m_boss_Rect.moveTo(m_boss_X,m_boss_Y);

    //子弹位置超出屏幕，重新变为闲置状态
    if(m_boss_Y>=GAME_HEIGHT+m_boss_Bullet.height())
    {
        m_boss_Free=true;
    }
}
